<template lang="pug">
  .tab-1
    //- .search-form.mb-10.pl-10.pr-10
    //-   Row(type="flex" justify="start")
    //-     Col.pr-20(span="8")
    //-       span.label-txt.w80 沟通时间：
    //-       DatePicker(type="date" placeholder="请选择")
    //-     Col.pr-20(span="8")
    //-       Button(type="info") 查询
    Table.hasTitle-table.beautiful-table(:columns="thead" :data="communicationList")
      //- template(slot-scope="{ row, index }" slot="action")
      //-   //- Button.mr-10(type="info" size="small" @click="") 修改
      //-   Button(type="text" size="small" @click="deleteCommunication(row.id)") 删除
      .clearfix.pl-20.pr-20(slot="footer")
        Page(:total="communicationTotal" :current="PageIndex" :page-size="PageSize" prev-text="上一页" next-text="下一页" @on-change="pageChangeFn" show-total @on-page-size-change="onpageSizeChange" show-sizer :page-size-opts="[10, 20, 30, 50, 100]")
</template>

<script>
import HRDCCustomerApi from '@/api/HRDCCustomer.api.js'

export default {
  props: {
    communicationList: Array,
    communicationTotal: Number
  },
  data () {
    return {
      isCheck: true,
      name: '总经理',
      checkModal: false,
      thead: [
        {
          title: '沟通时间',
          minWidth: 120,
          key: 'operateTime',
          render: (h, params) => {
            let row = params.row
            let times = row.operateTime.slice(0, 19).replace(/T/g, ' ')
            return h('span', times)
          }
        },
        {
          title: '沟通方式',
          minWidth: 120,
          key: 'communicationWayName'
        },
        {
          title: '沟通销售',
          minWidth: 100,
          key: 'createrName'
        },
        {
          title: '联系人',
          minWidth: 110,
          key: 'contactName'
        },
        {
          title: '沟通内容',
          minWidth: 200,
          key: 'summary'
        }
        // {
        //   title: '操作',
        //   minWidth: 120,
        //   slot: 'action'
        // }
      ],
      loading: false,
      PageIndex: 1,
      PageSize: 10
    }
  },
  methods: {
    creatOpen () {
      this.checkModal = true
    },
    tableSelectChange () {

    },
    deleteCommunication (id) {
      HRDCCustomerApi.DeleteCommunication({
        id: id
      }).then(res => {
        if (res.data.success) {
          this.$Message.success(res.data.message)
          this.$emit('get-list')
        } else {
          this.$Message.error({
            content: res.data.message,
            duration: 10,
            closable: true
          })
        }
      })
    },
    pageChangeFn () {

    },
    onpageSizeChange () {

    }
  }
}
</script>

<style>

</style>
